<!doctype html>


<html>
<head>
  <link rel="shortcut icon" href="static/images/favicon.ico" type="image/x-icon">
  <title>soy (Closure Library API Documentation - JavaScript)</title>
  <link rel="stylesheet" href="static/css/base.css">
  <link rel="stylesheet" href="static/css/doc.css">
  <link rel="stylesheet" href="static/css/sidetree.css">
  <link rel="stylesheet" href="static/css/prettify.css">

  <script>
     var _staticFilePath = "static/";
     var _typeTreeName = "goog";
     var _fileTreeName = "Source";
  </script>

  <script src="static/js/doc.js">
  </script>


  <meta charset="utf8">
</head>

<body onload="grokdoc.onLoad();">

<div id="header">
  <div class="g-section g-tpl-50-50 g-split">
    <div class="g-unit g-first">
      <a id="logo" href="index.html">Closure Library API Documentation</a>
    </div>

    <div class="g-unit">
      <div class="g-c">
        <strong>Go to class or file:</strong>
        <input type="text" id="ac">
      </div>
    </div>
  </div>
</div>





<div class="colmask rightmenu">
<div class="colleft">
    <div class="col1">
      <!-- Column 1 start -->

<div id="title">
       <span class="fn">soy</span>
</div>

<hr/>


  <h2>Classes</h2>
 <div class="fn-constructor">
        <a href="interface_goog_soy_InjectedDataSupplier.html">
          goog.soy.InjectedDataSupplier</a><br/>
        <div class="class-details">An interface for a supplier that provides Soy injected data.</div>
 </div>
 <div class="fn-constructor">
        <a href="class_goog_soy_Renderer.html">
          goog.soy.Renderer</a><br/>
        <div class="class-details">Creates a new soy renderer. Note that the renderer will only be
guaranteed to work correctly within the document scope provided in
the DOM helper.</div>
 </div>
   
<br/>

  <div class="legend">
        <span class="key publickey"></span><span>Public</span>
        <span class="key protectedkey"></span><span>Protected</span>
        <span class="key privatekey"></span><span>Private</span>
  </div>









<div class="section">
  <table class="horiz-rule">


  </table>
</div>




  <h2>Global Functions</h2>





<div class="section">
  <table class="horiz-rule">


     <tr class="even entry public">
       <td class="access"></td>






  <td>
    <a name="goog.soy.renderAsElement"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryNamespace">goog.soy.</span><span class="entryName">renderAsElement<span class="args">(<span class="arg">template</span>,&nbsp;<span class="arg">opt_templateData</span>,&nbsp;<span class="arg">opt_injectedData</span>,&nbsp;<span class="arg">opt_domHelper</span>)</span>
        </span>
        &#8658; <div class="fullType"><span class="type"><a href="https://developer.mozilla.org/en/DOM/Element">Element</a></span></div>
      </div>


     <div class="entryOverview">
       Renders a Soy template into a single node. If the rendered
HTML string represents a single node, then that node is returned. Otherwise,
a DIV element is returned containing the rendered nodes.
     </div>


    <! -- Method details -->
    <div class="entryDetails">

      <div class="detailsSection">
        <b>Arguments: </b>






<table class="horiz-rule">
     
   <tr class="even">
     <td>
        <span class="entryName">template</span>
        : <div class="fullType">(<span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Function">Function</a></span><span>&nbsp;|&nbsp;</span><span class="type">null</span>)</div>
        <div class="entryOverview">The Soy template defining the element's content.</div>
     </td>
   </tr>
     
   <tr class="odd">
     <td>
        <span class="entryName">opt_templateData</span>
        : <div class="fullType">(<span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Object">Object</a></span><span>&nbsp;|&nbsp;</span><span class="type">null</span><span>&nbsp;|&nbsp;</span><span class="type">undefined</span>)</div>
        <div class="entryOverview">The data for the template.</div>
     </td>
   </tr>
     
   <tr class="even">
     <td>
        <span class="entryName">opt_injectedData</span>
        : <div class="fullType">(<span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Object">Object</a></span><span>&nbsp;|&nbsp;</span><span class="type">null</span><span>&nbsp;|&nbsp;</span><span class="type">undefined</span>)</div>
        <div class="entryOverview">The injected data for the template.</div>
     </td>
   </tr>
     
   <tr class="odd">
     <td>
        <span class="entryName">opt_domHelper</span>
        : <div class="fullType">(<span class="type"><a href="class_goog_dom_DomHelper.html">goog.dom.DomHelper</a></span><span>&nbsp;|&nbsp;</span><span class="type">null</span><span>&nbsp;|&nbsp;</span><span class="type">undefined</span>)</div>
        <div class="entryOverview">The DOM helper used to create DOM nodes; defaults to <code>goog.dom.getDomHelper</code>.</div>
     </td>
   </tr>
  </table>
      </div>
   
      <div class="detailsSection">
        <b>Returns:</b>&nbsp;<div class="fullType"><span class="type"><a href="https://developer.mozilla.org/en/DOM/Element">Element</a></span></div>&nbsp;
            Rendered template contents, wrapped in a parent DIV element if necessary.
      </div>
  
    </div>
   
  </td>


  <td class="view-code">
     <a href="closure_goog_soy_soy.js.source.html#line95">code &raquo;</a>
  </td>
     </tr>


     <tr class="odd entry public">
       <td class="access"></td>






  <td>
    <a name="goog.soy.renderAsFragment"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryNamespace">goog.soy.</span><span class="entryName">renderAsFragment<span class="args">(<span class="arg">template</span>,&nbsp;<span class="arg">opt_templateData</span>,&nbsp;<span class="arg">opt_injectedData</span>,&nbsp;<span class="arg">opt_domHelper</span>)</span>
        </span>
        &#8658; <div class="fullType"><span class="type"><a href="https://developer.mozilla.org/en/DOM/Node">Node</a></span></div>
      </div>


     <div class="entryOverview">
       Renders a Soy template into a single node or a document
fragment. If the rendered HTML string represents a single node, then that
node is returned (note that this is *not* a fragment, despite them name of
the method). Otherwise a document fragment is returned containing the
rendered nodes.
     </div>


    <! -- Method details -->
    <div class="entryDetails">

      <div class="detailsSection">
        <b>Arguments: </b>






<table class="horiz-rule">
     
   <tr class="even">
     <td>
        <span class="entryName">template</span>
        : <div class="fullType">(<span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Function">Function</a></span><span>&nbsp;|&nbsp;</span><span class="type">null</span>)</div>
        <div class="entryOverview">The Soy template defining the element's content.</div>
     </td>
   </tr>
     
   <tr class="odd">
     <td>
        <span class="entryName">opt_templateData</span>
        : <div class="fullType">(<span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Object">Object</a></span><span>&nbsp;|&nbsp;</span><span class="type">null</span><span>&nbsp;|&nbsp;</span><span class="type">undefined</span>)</div>
        <div class="entryOverview">The data for the template.</div>
     </td>
   </tr>
     
   <tr class="even">
     <td>
        <span class="entryName">opt_injectedData</span>
        : <div class="fullType">(<span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Object">Object</a></span><span>&nbsp;|&nbsp;</span><span class="type">null</span><span>&nbsp;|&nbsp;</span><span class="type">undefined</span>)</div>
        <div class="entryOverview">The injected data for the template.</div>
     </td>
   </tr>
     
   <tr class="odd">
     <td>
        <span class="entryName">opt_domHelper</span>
        : <div class="fullType">(<span class="type"><a href="class_goog_dom_DomHelper.html">goog.dom.DomHelper</a></span><span>&nbsp;|&nbsp;</span><span class="type">null</span><span>&nbsp;|&nbsp;</span><span class="type">undefined</span>)</div>
        <div class="entryOverview">The DOM helper used to create DOM nodes; defaults to <code>goog.dom.getDomHelper</code>.</div>
     </td>
   </tr>
  </table>
      </div>
   
      <div class="detailsSection">
        <b>Returns:</b>&nbsp;<div class="fullType"><span class="type"><a href="https://developer.mozilla.org/en/DOM/Node">Node</a></span></div>&nbsp;
            The resulting node or document fragment.
      </div>
  
    </div>
   
  </td>


  <td class="view-code">
     <a href="closure_goog_soy_soy.js.source.html#line73">code &raquo;</a>
  </td>
     </tr>


     <tr class="even entry public">
       <td class="access"></td>






  <td>
    <a name="goog.soy.renderElement"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryNamespace">goog.soy.</span><span class="entryName">renderElement<span class="args">(<span class="arg">element</span>,&nbsp;<span class="arg">template</span>,&nbsp;<span class="arg">opt_templateData</span>,&nbsp;<span class="arg">opt_injectedData</span>)</span>
        </span>
      </div>


     <div class="entryOverview">
       Renders a Soy template and then set the output string as
the innerHTML of an element. It is recommended to use this helper function
instead of directly setting innerHTML in your hand-written code, so that it
will be easier to audit the code for cross-site scripting vulnerabilities.
     </div>


    <! -- Method details -->
    <div class="entryDetails">

      <div class="detailsSection">
        <b>Arguments: </b>






<table class="horiz-rule">
     
   <tr class="even">
     <td>
        <span class="entryName">element</span>
        : <div class="fullType">(<span class="type"><a href="https://developer.mozilla.org/en/DOM/Element">Element</a></span><span>&nbsp;|&nbsp;</span><span class="type">null</span>)</div>
        <div class="entryOverview">The element whose content we are rendering into.</div>
     </td>
   </tr>
     
   <tr class="odd">
     <td>
        <span class="entryName">template</span>
        : <div class="fullType">(<span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Function">Function</a></span><span>&nbsp;|&nbsp;</span><span class="type">null</span>)</div>
        <div class="entryOverview">The Soy template defining the element's content.</div>
     </td>
   </tr>
     
   <tr class="even">
     <td>
        <span class="entryName">opt_templateData</span>
        : <div class="fullType">(<span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Object">Object</a></span><span>&nbsp;|&nbsp;</span><span class="type">null</span><span>&nbsp;|&nbsp;</span><span class="type">undefined</span>)</div>
        <div class="entryOverview">The data for the template.</div>
     </td>
   </tr>
     
   <tr class="odd">
     <td>
        <span class="entryName">opt_injectedData</span>
        : <div class="fullType">(<span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Object">Object</a></span><span>&nbsp;|&nbsp;</span><span class="type">null</span><span>&nbsp;|&nbsp;</span><span class="type">undefined</span>)</div>
        <div class="entryOverview">The injected data for the template.</div>
     </td>
   </tr>
  </table>
      </div>
   
  
    </div>
   
  </td>


  <td class="view-code">
     <a href="closure_goog_soy_soy.js.source.html#line51">code &raquo;</a>
  </td>
     </tr>


     <tr class="odd entry private">
       <td class="access"></td>






  <td>
    <a name="goog.soy.verifyTemplateOutputSafe_"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryNamespace">goog.soy.</span><span class="entryName">verifyTemplateOutputSafe_<span class="args">(<span class="arg">templateResult</span>)</span>
        </span>
        &#8658; <div class="fullType"><span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String">string</a></span></div>
      </div>


     <div class="entryOverview">
       Verifies that a template result is "safe" to insert as HTML.

Note if the template is non-strict autoescape, the guarantees here are very
weak. It is recommended applications switch to requiring strict
autoescaping over time.
     </div>


    <! -- Method details -->
    <div class="entryDetails">

      <div class="detailsSection">
        <b>Arguments: </b>






<table class="horiz-rule">
     
   <tr class="even">
     <td>
        <span class="entryName">templateResult</span>
        : <div class="fullType"><span class="type">*</span></div>
        <div class="entryOverview">The template result.</div>
     </td>
   </tr>
  </table>
      </div>
   
      <div class="detailsSection">
        <b>Returns:</b>&nbsp;<div class="fullType"><span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String">string</a></span></div>&nbsp;
            The assumed-safe HTML output string.
      </div>
  
    </div>
   
  </td>


  <td class="view-code">
     <a href="closure_goog_soy_soy.js.source.html#line127">code &raquo;</a>
  </td>
     </tr>


  </table>
</div>



  <h2>Global Properties</h2>





<div class="section">
  <table class="horiz-rule">


     <tr class="even entry private">
       <td class="access"></td>





  <a name="goog.soy.defaultTemplateData_"></a>

  <td>


     <div class="arg">
        <img align="left" src="static/images/blank.gif">

        <span class="entryNamespace">goog.soy.</span><span class="entryName">defaultTemplateData_</span>
        : <div class="fullType">(<span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Object">Object</a></span><span>&nbsp;|&nbsp;</span><span class="type">null</span>)</div>
     </div>


     <div class="entryOverview">
       Immutable object that is passed into templates that are rendered
without any data.
     </div>

  </td>


  <td class="view-code">
     <a href="closure_goog_soy_soy.js.source.html#line162">Code &raquo;</a>
  </td>
     </tr>


  </table>
</div>
      <!-- Column 1 end -->
    </div>

        <div class="col2">
          <!-- Column 2 start -->
          <div class="col2-c">
            <h2 id="ref-head">Package soy</h2>
            <div id="localView"></div>
          </div>

          <div class="col2-c">
            <h2 id="ref-head">Package Reference</h2>
            <div id="sideTypeIndex" rootPath="" current="soy"></div>
          </div>
          <!-- Column 2 end -->
        </div>
</div>
</div>

</body>
</html>
